//
//  UIBarButtonItem+Extension.swift
//  TYCWeiBo
//
//  Created by 中发 on 2018/5/30.
//  Copyright © 2018年 中发. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    convenience init(title: String, fontSize: CGFloat = 16, target:Any?, action: Selector, isBack: Bool = false) {
        let btn: UIButton = UIButton (title: title, fontSize: fontSize, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        if isBack {
            let imageName = ""
            
            btn.setImage(UIImage(named: imageName), for: .normal)
            btn.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
            btn.sizeToFit()
        }
        btn.addTarget(target, action: action, for: .touchUpInside)
        
        self.init(customView: btn)
    }
}
